program SRVR.HYGL;

uses
  Vcl.SvcMgr,
  Vcl.Forms,
  rtcService,
  SRVR_MAIN in 'SRVR_MAIN.pas' {SRVRHYGL: TService},
  Form_Main in 'Form_Main.pas' {FormMain},
  Modl_HTTP in 'Modl_HTTP.pas' {ModlHttp: TDataModule},
  Class_Memb in '..\Client\Source\Lib\Class\Class_Memb.pas',
  Helpr_UniEngine in '..\Client\Source\Lib\Class\Helpr_UniEngine.pas';

{$R *.RES}

begin
  // Windows 2003 Server requires StartServiceCtrlDispatcher to be
  // called before CoRegisterClassObject, which can be called indirectly
  // by Application.Initialize. TServiceApplication.DelayInitialize allows
  // Application.Initialize to be called from TService.Main (after
  // StartServiceCtrlDispatcher has been called).
  //
  // Delayed initialization of the Application object may affect
  // events which then occur prior to initialization, such as
  // TService.OnCreate. It is only recommended if the ServiceApplication
  // registers a class object with OLE and is intended for use with
  // Windows 2003 Server.
  //
  // Application.DelayInitialize := True;
  //
  if not IsDesktopMode(CONST_SRVR_NAME) then
  begin
    if not Vcl.SvcMgr.Application.DelayInitialize or Vcl.SvcMgr.Application.Installing then
    begin
      Vcl.SvcMgr.Application.Initialize;
    end;
    Vcl.SvcMgr.Application.CreateForm(TSRVRHYGL, SRVRHYGL);
    Vcl.SvcMgr.Application.CreateForm(TModlHttp, ModlHttp);
    Vcl.SvcMgr.Application.Run;
  end else
  begin
    Vcl.Forms.Application.Initialize;
    Vcl.Forms.Application.Title := 'SRVR.HYGL';
    Vcl.Forms.Application.CreateForm(TModlHttp, ModlHttp);
    Vcl.Forms.Application.CreateForm(TFormMain, FormMain);
    Vcl.Forms.Application.Run;
  end;

end.
